package com.tycmc.signelectroniccontracts.tools.show;

import android.content.Context;
import android.widget.Toast;

import com.tycmc.signelectroniccontracts.tools.manager.AppManager;


/**
 * Created by Spinel on 15/9/15.
 * Edited by Spinel on 15/11/4.
 */
public class ToastShow {
    private static Toast toast;

    public ToastShow() {
        throw new AssertionError();
    }

    public static void popupToast(Context mContext, String msg) {
        if (toast != null) {
            toast.cancel();
        }
        if (mContext != null) {
            toast = Toast.makeText(mContext, msg, Toast.LENGTH_SHORT);
            toast.show();
        }
    }
    public static void popupToast(String msg){
        if (toast != null) {
            toast.cancel();
        }
        if (AppManager.getAppManager().currentActivity() != null) {
            toast= Toast.makeText(AppManager.getAppManager().currentActivity(),msg, Toast.LENGTH_SHORT);
            toast.show();
        }
    }

    public static void dismiss() {
        if (toast != null) {
            toast.cancel();
        }
    }

}
